/*#define BOOST_TEST_MODULE big_int test
#define BOOST_TEST_MAIN

#include <cmath>
#include <limits>

#include <boost/test/included/unit_test.hpp>
#include "boost/random/mersenne_twister.hpp"
#include "boost/random/uniform_int_distribution.hpp"

#include "geometry_primitives.h"
#include "bounding_box.h"

using namespace boost;
#undef max


namespace
{
        const size_t test_size = 100;
        const double rough_eps = 1e-10;
        const double double_eps = std::numeric_limits<double>::epsilon();

        boost::random::mt19937 twister;

        int get_random_int(int inf, int sup) // from [inf; sup]
        {
                boost::random::uniform_int_distribution<> dist(inf, sup);
                return dist(twister);
        }

        double get_random_double() // from [0; 1)
        {
           boost::random::uniform_int_distribution<> dist(0, std::numeric_limits<int>::max() - 1);
           return static_cast<double>(dist(twister))/(std::numeric_limits<int>::max());
        }
}


BOOST_AUTO_TEST_CASE( on_one_line )
{

        BOOST_CHECK(are_intersect(segment(point(0, 0), point(2, 2)), segment(point(1, 1), point(3, 3))));
        BOOST_CHECK(!are_intersect(segment(point(0, 0), point(1, 1)), segment(point(2, 2), point(3, 3))));
        BOOST_CHECK(are_intersect(segment(point(0, 0), point(1, 1)), segment(point(1 - rough_eps, 1 - rough_eps), point(2, 2))));
        BOOST_CHECK(are_intersect(segment(point(0, 0), point(1, 1)), segment(point(1, 1), point(2, 2))));
        BOOST_CHECK(!are_intersect(segment(point(0, 0), point(1, 1)), segment(point(1 + rough_eps, 1 + rough_eps), point(2, 2))));
        BOOST_CHECK(are_intersect(segment(point(0, 0), point(3, 3)), segment(point(1, 1), point(2, 2))));
        BOOST_CHECK(are_intersect(segment(point(1, 1), point(2, 2)), segment(point(0, 0), point(3, 3))));
}

BOOST_AUTO_TEST_CASE( explicitly_intersect )
{
        BOOST_CHECK(are_intersect(segment(point(0, 0), point(1, 1)), segment(point(0, 1), point(1, 0))));
}

BOOST_AUTO_TEST_CASE( explicitly_do_not_intersect )
{
        BOOST_CHECK(!are_intersect(segment(point(0, 0), point(2, 0)), segment(point(1, 1), point(2, 1))));
}

BOOST_AUTO_TEST_CASE( one_end_at_other_segment )
{
        BOOST_CHECK(are_intersect(segment(point(0, 0), point(2, 0)), segment(point(1, 0), point(1, 1))));
        BOOST_CHECK(!are_intersect(segment(point(0, 0), point(2, 0)), segment(point(1, rough_eps), point(1, 1))));
        double pow2_100 = std::pow(2., 100);
        double pow2_99 = std::pow(2., 99);
        BOOST_CHECK(!are_intersect(segment(point(1, 1 + double_eps), point(pow2_100, pow2_100)), segment(point(pow2_100, 1), point(pow2_99, pow2_99))));
        BOOST_CHECK(are_intersect(segment(point(1, 1 - double_eps), point(pow2_100, pow2_100)), segment(point(pow2_100, 1), point(pow2_99, pow2_99))));
        BOOST_CHECK(are_intersect(segment(point(1, 1), point(pow2_100, pow2_100)), segment(point(pow2_100, 1), point(pow2_99, pow2_99))));
}

BOOST_AUTO_TEST_CASE( parallel_lines )
{
        BOOST_CHECK(!are_intersect(segment(point(0, 0), point(1, 1)), segment(point(1, 0), point(2, 1))));
        BOOST_CHECK(!are_intersect(segment(point(1, 1), point(100, 1)), segment(point(1, 1 + double_eps), point(100, 1 + double_eps))));
        BOOST_CHECK(are_intersect(segment(point(1, 1), point(100, 1)), segment(point(1, 1 + double_eps), point(100, 1 - double_eps))));
        BOOST_CHECK(are_intersect(segment(point(1, 1), point(501, 1 + double_eps)), segment(point(1000, 1), point(500, 1 + double_eps))));
        BOOST_CHECK(!are_intersect(segment(point(1, 1), point(499, 1 + double_eps)), segment(point(500, 1 + double_eps), point(1000, 1))));
}

BOOST_AUTO_TEST_CASE( dots )
{
        BOOST_CHECK(are_intersect(segment(point(10, 10), point(10, 10)), segment(point(10, 10), point(10, 10))));
        BOOST_CHECK(are_intersect(segment(point(9, 9), point(11, 11)), segment(point(10, 10), point(10, 10))));
        BOOST_CHECK(!are_intersect(segment(point(10, 10), point(10, 10)), segment(point(11, 11), point(11, 11))));
        BOOST_CHECK(!are_intersect(segment(point(9, 9), point(11, 11)), segment(point(12, 12), point(14, 14))));
}

BOOST_AUTO_TEST_CASE( fedors_test )
{
        long long a_x1_i = - 4173913987958382965;
        long long a_y1_i = - 4175629442307164797;
        long long b_x1_i = - 4178459053280305183;
        long long b_y1_i = - 4170294073085123280;
        long long a_x2_i = - 4173913987958382965;
        long long a_y2_i = - 4175629442307164797;
        long long b_x2_i = - 4178459053280305183;
        long long b_y2_i = - 4170294073085123279;

        double a_x1 = *reinterpret_cast<double*>(&a_x1_i);
        double b_x1 = *reinterpret_cast<double*>(&b_x1_i);
        double a_x2 = *reinterpret_cast<double*>(&a_x2_i);
        double b_x2 = *reinterpret_cast<double*>(&b_x2_i);
        double a_y1 = *reinterpret_cast<double*>(&a_y1_i);
        double b_y1 = *reinterpret_cast<double*>(&b_y1_i);
        double a_y2 = *reinterpret_cast<double*>(&a_y2_i);
        double b_y2 = *reinterpret_cast<double*>(&b_y2_i);


        segment segment1(point((a_x1), (a_y1)), point((b_x1), (b_y1)));
        segment segment2(point((a_x2), (a_y2)), point((b_x2), (b_y2)));

        bool x = are_intersect(segment1, segment2);
        BOOST_CHECK(x);


        segment segment3(point(0, 0), point(1, 0));
        segment segment4(point(0, 1), point(2, 0));
        BOOST_CHECK(!are_intersect(segment3, segment4));
}

BOOST_AUTO_TEST_CASE ( bipartite_segments )
{
        for (int j = 0; j != test_size; j++)
        {
                const size_t inner_test_size = test_size;
                double d1, d2;
                double left[inner_test_size];
                double right[inner_test_size];
                double * y1 = &d1;
                long long * long_y1 = reinterpret_cast<long long *>(y1);
                *y1 = (get_random_double()) * std::pow(2., get_random_int(-128, 128));
                double x1 = (get_random_double() - 2) * std::pow(2., get_random_int(-128, 128));
                double * y2 = &d2;
                long long * long_y2 = reinterpret_cast<long long *>(y2);
                *y2 = (get_random_double()) * std::pow(2., get_random_int(-128, 128));
                double x2 = (get_random_double() + 1) * std::pow(2., get_random_int(-128, 128));
                for (size_t i = 0; i != inner_test_size; ++i)
                {
                        *long_y1 += 1;
                        *long_y2 += 1;
                        left[i] = *y1;
                        right[i] = *y2;
                }
                for (size_t i = 0; i != inner_test_size; ++i)
                {
                        int a = get_random_int(0, inner_test_size - 1);
                        int b = get_random_int(0, inner_test_size - 1);
                        int c = get_random_int(0, inner_test_size - 1);
                        int d = get_random_int(0, inner_test_size - 1);
                        bool b1 = are_intersect(segment(point(x1, left[a]), point(x2, right[b])), segment(point(x1, left[c]), point(x2, right[d])));
                        bool b2 = are_intersect(segment(point(-1, a), point(1, b)), segment(point(-1, c), point(1, d)));
                        BOOST_CHECK_EQUAL(b1, b2);
                }
        }
}


BOOST_AUTO_TEST_CASE( construction_test ) 
{
   point a(1, 2);
   BOOST_CHECK_EQUAL(a.x, 1);
   BOOST_CHECK_EQUAL(a.y, 2);
   point b;
   BOOST_CHECK_EQUAL(b.x, 0);
   BOOST_CHECK_EQUAL(b.y, 0);
   segment seg(a, b);
   BOOST_CHECK_EQUAL(seg.a, b);
   BOOST_CHECK_EQUAL(seg.b, a);
}

BOOST_AUTO_TEST_CASE( bounding_box_test ) 
{
   segment a(point(0, 0), point(1, 1));
   segment b(point(1, 0), point(100, 0));
   BOOST_CHECK_EQUAL(is_bounding_boxes_intersect(a, b), true);
   segment c(point(0, 0), point(1, 1));
   segment d(point(2, 2), point(100, 0));
   BOOST_CHECK_EQUAL(is_bounding_boxes_intersect(c, d), false);
}

BOOST_AUTO_TEST_CASE( simple_intersection ) 
{
   segment a(point(0, 0), point(1, 1));
   segment b(point(1, 0), point(100, 0));
   BOOST_CHECK_EQUAL(are_intersect(a, b), false);
   
   segment c(point(0, 0), point(1, 1));
   segment d(point(2, 2), point(100, 0));
   BOOST_CHECK_EQUAL(are_intersect(c, d), false);

   segment e(point(0, 0), point(1, 1));
   segment f(point(0, 1), point(1, 0));
   BOOST_CHECK_EQUAL(are_intersect(e, f), true);
}*/